class Solution {
        int dest=-1;
        int cur=0;
    public void duplicateZeros(int[] arr) {
       
        find(arr,dest,cur);
        while(cur>=0){
            if(arr[cur]!=0){
                arr[dest]=arr[cur];
                dest--;
                cur--;
            }else{
                arr[dest]=0;
                arr[dest-1]=0;
                dest-=2;
                cur--;
            }
        }



    }
    public void find(int[] arr,int dest,int cur){
        while(cur<arr.length){
            if(arr[cur]==0){
            dest+=2;
            if(dest==arr.length-1){
               break;
            }
            cur++;
        }else{
              dest++;
              if(dest==arr.length-1){
                 break;
            }
           
            cur++;
        }
        }
        
      
    }
}